import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig(({ mode }) => {
  const root = new URL('.', import.meta.url).pathname
  const env = loadEnv(mode, root, '')
  return {
    plugins: [vue()],
    server: {
      port: 5173,
      host: '0.0.0.0',
      proxy: {
        '/api': env.VITE_API_BASE || 'http://localhost:8000'
      }
    }
  }
})
